<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>

</body>
<script>
let a = {username:'zs'}
let b = {age: 20}
//对象
//es5
/*
let c = {}
for(var key in a){
  c[key] = a[key]
}
for(var key in b){
  c[key] = b[key]
}
*/
//es6
//通过方法
/*
let c = {}
Object.assign(c, a, b)
*/
//通过扩展运算符
// let c = {...a, ...b}

// console.log(c)

let m = [1,2]
let n = [3,4]
let l = []
//es5
//循环
/*
for (let i = 0; i < m.length; i++) {
  l.push(m[i])
}
for (let i = 0; i < n.length; i++) {
  l.push(n[i])
}
*/
//方法
// l = m.concat(n)
//es6
//通过扩展运算符
l = [...m, ...n]
console.log(l)
</script>
</html>
